package com.zy.entity.dto;

import com.zy.annotation.ValidTelephone;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @Author CarreyZhou
 * @Date: 2024/5/3 13:24
 */
@Data
public class RegisterUserDTO implements Serializable {
    private static final long serialVersionUID = 4802720733546197865L;

    @NotBlank(message = "用户名不能为空")
    @Length(min = 4, max = 10, message = "用户名长度必须在4-10之间")
    private String username;

    @Length(min = 6, max = 16, message = "密码长度必须在6-16之间")
    @NotBlank(message = "密码不能为空")
    private String password;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    @ValidTelephone(message = "手机号格式不正确")
    private String phone;

    @Min(value = 1, message = "年龄必须大于等于1")
    @Max(value = 150, message = "年龄必须小于等于150")
    @NotNull(message = "年龄不能为空")
    private Integer age;

}
